package com.mz.mattress.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mz.mattress.admin.api.req.PlanDateQueryReq;
import com.mz.mattress.admin.mapper.PlanTaskDataMapper;
import com.mz.mattress.admin.service.PlanTaskDataService;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.PlanTaskData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class PlanTaskDataServiceImpl implements PlanTaskDataService {

    @Autowired
    private PlanTaskDataMapper planTaskDataMapper;

    @Override
    public Result<IPage<PlanTaskData>> listPage(PlanDateQueryReq req) {
        Page<PlanTaskData> listPage = planTaskDataMapper.listPage(req.newPage(), req.getDates(), req.getGoodsId());
        return Result.ok(listPage);
    }

    @Override
    public Result<PlanTaskData> getById(Integer id) {
        PlanTaskData planTaskData = planTaskDataMapper.selectById(id);
        return Result.ok(planTaskData);
    }

}
